<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:ry="">
	<head>
		<th:block th:include="include :: header('新增通知公告')" />
		<th:block th:include="include :: summernote-css" />
	</head>
	<body class="white-bg">
	    <div class="wrapper wrapper-content animated fadeInRight ibox-content">
	        <form class="form-horizontal m" id="form-notice-add">
				<div class="form-group">
					<label class="col-sm-2 control-label is-required">公告标题：</label>
					<div class="col-sm-10">
						<input id="notice_title" name="notice_title" class="form-control" type="text" required/>
					</div>
				</div>
				<div class="form-group">
					<label class="col-sm-2 control-label is-required">公告类型：</label>
					<div class="col-sm-10">
						<ry:selectDict dictType="sys_notice_type" name="notice_type" class="form-control m-b" required/>
					</div>
				</div>
				<div class="form-group">
					<label class="col-sm-2 control-label is-required">公告内容：</label>
					<div class="col-sm-10">
                        <textarea name="notice_content" id="notice_content"></textarea>
					</div>
				</div>
				<div class="form-group">
					<label class="col-sm-2 control-label">公告状态：</label>
					<div class="col-sm-10">
					    <ry:radioDict dictType="sys_notice_status" name="status" class="radio-box" required="true" />
					</div>
				</div>
			</form>
		</div>
	    <th:block th:include="include :: footer" />
	    <th:block th:include="include :: summernote-js" />
	    <script type="text/javascript">
	        var prefix = ctx + "system/notice";

            $(function() {
                $("#form-notice-add").validate({
                    focusCleanup: true
                });
                //初始化summernote富文本控件
                $.rySummernote.init($("#notice_content"), "请输入公告内容", 200);
            });

			function submitHandler() {
		        if ($.validate.form()) {
                    var notice_content = $("#notice_content").summernote("code");
                    if($.common.isEmpty(notice_content) || notice_content == "<p><br></p>") {
                        $.modal.alertWarning("请输入公告内容");
                        return;
                    }
					$.operate.save(prefix + "/save", $('#form-notice-add').serialize());
		        }
		    }
		</script>
	</body>
</html>